package com.liaoyoule.multiple.dao.en;

import java.util.Date;

/**
 * Created by cdyoue on 2017/2/24.
 */
public enum DataTypeEnum {
    INTEGER(Integer.class,1),
    LONG(Long.class,2),
    DOUBLE(Double.class, 3),
    STRING(String.class,4),
    DATE(Date.class,5);

    private Class dataType;
    private Integer type;
    DataTypeEnum(Class dataType, Integer type) {
        this.dataType = dataType;
        this.type = type;
    }
    public static Class getTypeClass(Integer type) {
        if(type == null){
            return DataTypeEnum.STRING.getDataType();
        }
        for (DataTypeEnum oct : DataTypeEnum.values()) {
            if (oct.getType()==(type)) {
                return oct.getDataType();
            }
        }
        return DataTypeEnum.STRING.getDataType();
    }

    public Class getDataType() {
        return dataType;
    }

    public void setDataType(Class dataType) {
        this.dataType = dataType;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }
}
